package com.junhong.util;

public class StringUtil {

	/**
	 * 
	 * convert HTMl <BR>
	 * to OS-based new line code
	 * 
	 * @param ori
	 * @param des
	 */
	public static String br2nl(String ori) {

		String eol = System.getProperty("line.separator");
		return ori.replaceAll("(<br>|<br/>)", eol).replaceAll("</br>", "");

	}

	/**
	 * convert os-based new line code to HTML <BR>
	 * convert HTMl <BR>
	 * to OS-based new line code
	 * 
	 * @param ori
	 * @param des
	 */
	public static String nl2br(String ori) {

		return ori.replaceAll("(\r\n|\r|\n|\n\r)", "<br/>");

	}

	public static boolean isNullOrBlank(String string) {
		return string == null || string.length() == 0;
	}

}
